package com.hl233.auth.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.client.ServiceInstance;
import org.springframework.cloud.client.discovery.DiscoveryClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author 张振强15065206763
 * @create 2024-09-10
 */
@RestController
@RequestMapping("/auth")
public class AuthController {
    @Autowired
    private DiscoveryClient discoveryClient;

    @GetMapping("/query")
    public String queryAll() {

        List<ServiceInstance> list =discoveryClient.getInstances("hl233-device");



        return list.get(0).getUri()+"";
    }
}
